package com.demonzym.framework.net.http;

import com.demonzym.framework.net.http.HttpListener.IHttpListener;

public class HttpManager {

	public static void pushHttpGet(String url, IHttpListener l){
		HttpRequest hr = new HttpRequest(url);
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
	public static void pushHttp(HttpRequest hr, IHttpListener l){
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
	public static void pushPostHttp(String path, String url, IHttpListener l){
		HttpRequest hr = new HttpRequest(url);
		hr.setPath(path);
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
	public static void pushPostHttp(String path, HttpRequest hr, IHttpListener l){
		hr.setPath(path);
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
	public static void pushPostHttp(byte[] data, String url, IHttpListener l){
		HttpRequest hr = new HttpRequest(url, data);
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
	public static void pushPostHttp(HttpRequest hr, IHttpListener l){
		HttpListener.getInstance().addHttpListener(hr.getRequestID(), l);
		hr.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(hr);
	}
}
